package com.hyh.springcloud.controller;

import com.hyh.springcloud.result.AjaxResult;
import com.hyh.springcloud.service.PaymentFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Summerday
 */

@RestController
@Slf4j
public class PaymentFeignController {

    @Resource
    private PaymentFeignClient paymentFeignClient;

    @GetMapping("/consumer/payment/{id}")
    public AjaxResult getById(@PathVariable("id") Long id){
        return paymentFeignClient.getById(id);
    }

    @GetMapping("/consumer/payment/timeOut")
    public String paymentTimeOut(){
        //openFeign ribbon客户端默认等待1s
        return paymentFeignClient.paymentTimeOut();
    }
}
